# Makefile for multi-thread TCP server and client

CXX = g++
CXXFLAGS = -std=c++11 -Wall

SRCS_SERVER = server.cpp
SRCS_CLIENT = client.cpp

TARGET_SERVER = server
TARGET_CLIENT = client

all: $(TARGET_SERVER) $(TARGET_CLIENT)

$(TARGET_SERVER): $(SRCS_SERVER)
	$(CXX) $(CXXFLAGS) -o $(TARGET_SERVER) $(SRCS_SERVER) -lpthread

$(TARGET_CLIENT): $(SRCS_CLIENT)
	$(CXX) $(CXXFLAGS) -o $(TARGET_CLIENT) $(SRCS_CLIENT)

clean:
	rm -f $(TARGET_SERVER) $(TARGET_CLIENT)

install:
	cp $(TARGET_SERVER) /usr/local/bin/
	cp $(TARGET_CLIENT) /usr/local/bin/

.PHONY: all clean install
